'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class user extends Model {
    static associate(models) {
    }
  };
  user.init({
    id: {
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      type: Sequelize.INTEGER,
      comment: '用户id'
    },
    username: {
      type: Sequelize.STRING(50),
      unique: true,
      allowNull: false,
      defaultValue: '',
      comment: '用户名'
    },
    password: {
      type: Sequelize.CHAR(32),
      allowNull: false,
      defaultValue: '',
      comment: '密码'
    },
    disabled: {
      type: Sequelize.BOOLEAN,
      allowNull: false,
      defaultValue: false,
      comment: '是否是禁用状态'
    },
    mobile: {
      type: Sequelize.CHAR(12),
      unique: true,
      allowNull: false,
      defaultValue: '',
      comment: '手机号码'
    },
    email: {
      type: Sequelize.STRING(50),
      unique: true,
      allowNull: false,
      defaultValue: '',
      comment: '邮箱'
    },
    created_ip_at: {
      type: Sequelize.CHAR(15),
      allowNull: false,
      field: 'created_ip_at',
      defaultValue: '',
      comment: '用户注册的ip地址'
    },
    undated_ip_at: {
      type: Sequelize.CHAR(15),
      allowNull: false,
      field: 'updated_ip_at',
      defaultValue: '',
      comment: '用户最新一次登录的ip地址'
    },
    created_at: {
      allowNull: false,
      type: Sequelize.DATE,
      filed: 'created_at',
      comment: '用户注册的时间'
    },
    updated_at: {
      allowNull: false,
      type: Sequelize.DATE,
      filed: 'updated_at',
      comment: '用户更新登录的时间'
    }
  }, {
    sequelize,
    modelName: 'user',
    tableName: 'user'
  });
  return user;
};